package collaboration.testcases;

/**
 * @author Trevor Clack 6286191
 * @author Bowen Cheng 6204467
 *
 * Since our project is heavily based on GUI, 
 * this code is the only one group (out of four) 
 * automated test case for our final project.
 * 
 */
import java.io.IOException;

import collaboration.client.CollabClient;

public class SEG2105TestCase1
{

	/**
	 * Main method for automated test cases on client ID
	 * @param args User input from command line
	 */
	 public static void main(String[] args)
	{
	
		//6 different test cases
		CollabClient[] client = new CollabClient[6];
		args = new String[6];
		
		/*Automated test case of client ID*/

		//test #1
		//Parameter: "name"
		args[0] = "\"name\"";

		//test #2
		//Parameter: (Space)
		args[1] = "";

		//test #3
		//Parameter: name
		args[2] = "name";

		//test #4
		//Parameter: null
		args[3] = null;

		//test #5
		//Parameter: s1 s2
		args[4] = "s1 s2";

		//test #6
		//Parameter: "s1 s2"
		args[5] = "\"s1 s2\"";
		
		//Case NO.i to be tested
		for (int i = 0; i <args.length; i++){
			System.out.println("Start of Test " + i + ".");
			try
			{
				client[i] = new CollabClient(args[i]);
				System.out.println("Success");
			}
			catch (IOException e)
			{
				System.out.println("Error: Unable to start Collaboration Client \n"+ e.toString());
			}
			catch(ArrayIndexOutOfBoundsException e)
			{
				System.out.println("Error: loginID is missing. \n\tUsage: \" CollabClient <loginID>\", where <loginID> is a unique identifier for your connection.\n\tNote: No spaces are allowed in <loginID>.");
			}
			System.out.println("End of Test " + i + ".");
		}
	}
}
